home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- import apt_inst
- import apt_pkg
- import apt
- import sys
- import os
- from gettext import gettext as _
- from DebPackage import DebPackage
- from Cache import Cache
-
- class DscSrcPackage(DebPackage):
-
- def __init__(self, cache, file = None):
- DebPackage.__init__(self, cache)
- self.file = file
- self.depends = []
- self.conflicts = []
- self.binaries = []
- if file != None:
- self.open(file)
-
-
-
- def getConflicts(self):
- return self.conflicts
-
-
- def getDepends(self):
- return self.depends
-
-
- def open(self, file):
- depends_tags = [
- 'Build-Depends:',
- 'Build-Depends-Indep:']
- conflicts_tags = [
- 'Build-Conflicts:',
- 'Build-Conflicts-Indep:']
- for line in open(file):
- for tag in depends_tags:
- if line.startswith(tag):
- key = line[len(tag):].strip()
- self.depends.extend(apt_pkg.ParseSrcDepends(key))
- continue
-
- for tag in conflicts_tags:
- if line.startswith(tag):
- key = line[len(tag):].strip()
- self.conflicts.extend(apt_pkg.ParseSrcDepends(key))
- continue
-
- if line.startswith('Source:'):
- self.pkgName = line[len('Source:'):].strip()
-
- if line.startswith('Version:'):
- self._sections['Version'] = line[len('Version:'):].strip()
-
- if line.startswith('-----BEGIN PGP SIGNATURE-'):
- break
- continue
-
- s = _("Install Build-Dependencies for source package '%s' that builds %s\n") % (self.pkgName, ' '.join(self.binaries))
- self._sections['Description'] = s
-
-
- def checkDeb(self):
- if not self.checkConflicts():
- for pkgname in self._installedConflicts:
- if self._cache[pkgname]._pkg.Essential:
- raise Exception, _('A essential package would be removed')
- self._cache[pkgname]._pkg.Essential
- self._cache[pkgname].markDelete()
-
-
- return self._satisfyDepends(self.depends)
-
-
- if __name__ == '__main__':
- cache = Cache()
- s = DscSrcPackage(cache)
- d = 'libc6 (>= 2.3.2), libaio (>= 0.3.96) | libaio1 (>= 0.3.96)'
- print s._satisfyDepends(apt_pkg.ParseDepends(d))
-
-